added Feb 2001 SDK
[windows-sources.git] / shared source / sscli20 / jscript / engine / voidop.cs
blobc74421b43fc0cc67a24418c1f415b480d4cb2f14
1 // ==++==
2 //
3 //
4 // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
5 //
6 // The use and distribution terms for this software are contained in the file
7 // named license.txt, which can be found in the root of this distribution.
8 // By using this software in any fashion, you are agreeing to be bound by the
9 // terms of this license.
10 //
11 // You must not remove this notice, or any other, from this software.
12 //
13 //
14 // ==--==
16 namespace Microsoft.JScript {
18 using System;
19 using System.Reflection;
20 using System.Reflection.Emit;
22 internal sealed class VoidOp : UnaryOp{
24 internal VoidOp(Context context, AST operand)
25 : base(context, operand) {
28 internal override Object Evaluate(){
29 this.operand.Evaluate();
30 return null;
33 internal override IReflect InferType(JSField inference_target){
34 return Typeob.Empty;
37 internal override AST PartiallyEvaluate(){
38 return new ConstantWrapper(null, this.context);
41 internal override void TranslateToIL(ILGenerator il, Type rtype){
42 this.operand.TranslateToIL(il, Typeob.Object); //force evaluation
43 if (rtype != Typeob.Void){
44 il.Emit(OpCodes.Ldsfld, CompilerGlobals.undefinedField);
45 Convert.Emit(this, il, Typeob.Object, rtype);
46 }else
47 il.Emit(OpCodes.Pop);